home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4307 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  989 b 

  1. Path: gail.ripco.com!mambuhl
  2. From: mambuhl@ripco.com (Martin Ambuhl)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: simple code, argc, ar
  5. Date: 3 Feb 1996 05:27:22 GMT
  6. Organization: Ripco Communications, Inc.
  7. Message-ID: <4eurnq$8oc@gail.ripco.com>
  8. NNTP-Posting-Host: golden.ripco.com
  9.  
  10. otisg@panther.middlebury.edu (Otis Gospodnetic)
  11. in <11f7cc$17261a.3b3@daprez> asks:
  12.  
  13. [snip]
  14. >Problem - I am doing something wrong and I almost always end up calling
  15. >Usage() even if I use the program correctly.
  16.  
  17. [snip]
  18. >  if (!strcmp(argv[1],"-d") || !strcmp(argv[1],"-e")) {
  19. >    Usage();
  20. Suppose arv[1] is "-d", then this is
  21.     if (1 /* || !strcmp(argv[1],"-e") */) ...
  22. Suppose argv[2] is "-e", then it is
  23.     if (0 || 1) ...
  24.  
  25. Only when argv[1] is neither "-d" nor "-e" is Usage() called.
  26.  
  27. Try
  28. >  if (strcmp(argv[1],"-d") && strcmp(argv[1],"-e")) {
  29.                                                                                         
  30. --
  31. * Martin Ambuhl       net: mambuhl@ripco.com
  32. * Chicago, IL (USA)    
  33.